package com.js.core.entity.result;

import lombok.Data;

/**
 * @ClassName EditorResult
 * @Description TODO
 * @Author mazp
 * @Date 2025/10/16 11:39
 */
@Data
public class EditorResult {
    private int errno;
    private String message;
    private Data data;


    public static class Data {
        private String url;
        private String alt;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getAlt() {
            return alt;
        }

        public void setAlt(String alt) {
            this.alt = alt;
        }
    }

    // 静态方法：创建成功响应
    public static EditorResult success(String url, String poster) {
        EditorResult result = new EditorResult();
        result.setErrno(0);
        Data data = new Data();
        data.setUrl(url);
        result.setData(data);
        return result;
    }

    // 静态方法：创建失败响应
    public static EditorResult error(String message) {
        EditorResult result = new EditorResult();
        result.setErrno(1);
        result.setMessage(message);
        return result;
    }
}
